

create external table jms_dm.dm_lmdm_four_segment_monitoring_detail_dt (
   date_time string COMMENT '日期' ,
   waybill_no string comment '运单号',
   order_source_code string comment '订单来源',
   sign_time timestamp  comment '签收时间',
   sign_finance_code string comment '签收财务网点编码',
   sign_finance_name string comment '签收财务网点名称',
   sign_network_code string comment '签收网点code',
   sign_network_name string comment '签收网点名称',
   receiver_province_id string comment '省份id',
   receiver_province_name string comment '省份name',
   receiver_city_id string comment '城市id',
   receiver_city_name string comment '城市name',
   receiver_area_id string comment '区域id',
   receiver_area_name string comment '区域name',
   sj_first_code string comment '签收一段码    ',
   sj_second_code string comment '签收二段码',
   sj_third_code string comment '签收三段码    ',
   courier_station_name string comment '签收驿站名称',
   input_type_name string comment '签收驿站品牌',
   station_code string comment '签收驿站码',
   station_unique_number string comment '签收驿站唯一标识',
   plan_station_code string comment '预测驿站码编码',
   plan_station_unique_number string comment '预测驿站码',
   courier_station_code string comment '签收驿站编码'

) COMMENT '驿站码解析监控'
PARTITIONED BY (dt STRING COMMENT '')
STORED AS PARQUET
LOCATION '/dw/hive/jms_dm.db/external/dm_lmdm_four_segment_monitoring_detail_dt'
TBLPROPERTIES (
'discover.partitions'='false',
'parquet.column.index.access'='true'
);



       
create  table jms_dm.dm_lmdm_four_segment_monitoring_detail_dt (
   date_time date COMMENT '日期' ,
   sign_network_code varchar(300) comment '签收网点code',
   sign_finance_code varchar(300) comment '签收财务网点编码',
   waybill_no varchar(300) comment '运单号',
   order_source_code varchar(300) comment '订单来源',
   sign_time datetime  comment '签收时间',
   sign_finance_name varchar(300) comment '签收财务网点名称',
   sign_network_name varchar(300) comment '签收网点名称',
   receiver_province_id varchar(300) comment '省份id',
   receiver_province_name varchar(300) comment '省份name',
   receiver_city_id varchar(300) comment '城市id',
   receiver_city_name varchar(300) comment '城市name',
   receiver_area_id varchar(300) comment '区域id',
   receiver_area_name varchar(300) comment '区域name',
   sj_first_code varchar(300) comment '签收一段码    ',
   sj_second_code varchar(300) comment '签收二段码',
   sj_third_code varchar(300) comment '签收三段码    ',
   courier_station_name varchar(300) comment '签收驿站名称',
   input_type_name varchar(300) comment '签收驿站品牌',
   station_code varchar(300) comment '签收驿站编码',
   station_unique_number varchar(300) comment '签收驿站码',
   plan_station_code varchar(300) comment '预测驿站码编码',
   plan_station_unique_number varchar(300) comment '预测驿站码',
   courier_station_code varchar(300)  comment '签收驿站编码'

  )
ENGINE=OLAP
DUPLICATE KEY(date_time,sign_network_code,sign_finance_code)
comment '驿站码解析监控'
PARTITION BY RANGE (date_time) (
   START ('2023-06-15') END ('2023-06-30') EVERY (INTERVAL 1 day))
   DISTRIBUTED BY HASH(date_time,sign_network_code) BUCKETS 4
PROPERTIES (
'replication_num' = '1',
'dynamic_partition.enable' = 'true',
'dynamic_partition.time_unit' = 'DAY',
'dynamic_partition.time_zone' = 'Asia/Shanghai',
'dynamic_partition.start' = '-180',
'dynamic_partition.end' = '3',
'dynamic_partition.prefix' = 'p',
'dynamic_partition.buckets' = '4',
'in_memory' = 'false',
'storage_format' = 'V2'
)
       

